#get_cookies():                           获取所有的cookie
#get_cookie(name):                       返回 字典中key为"name"的cookie
#add_cookie(cookie_dict):                 添加cookie
#delete_cookie(name,optionsString):        删除名为OpString的cookie
#delete_cookies():                         删除所有的cookie
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("http://www.baidu.com")
#获取所有的cookie并打印
cookie = driver.get_cookies()
print(cookie)
#添加cookie
driver.add_cookie({'name':'key_aaa','value':'key_bbbbb'})
#遍历所有的cookie
for cookie in driver.get_cookies():
    print("%s -> %s" % (cookie['name'],cookie['value']))

